package engine;

import constans.Globals;
import entity.Entity;

public class MapMatrix {

	Entity[][] map = new Entity[Globals.MAP_I][Globals.MAP_J];
	
	public MapMatrix()
	{
		for(int i = 0 ; i < Globals.MAP_I ; i++)
			for(int j = 0 ; j < Globals.MAP_J ; j++)
				map[i][j] = null;
	}
	
	public void addEntity(Entity e)
	{
		map[e.getI()][e.getJ()] = e;
	}
	public void releaseField(Entity e)
	{
		map[e.getI()][e.getJ()] = null;
	}
	
	public boolean isFieldEmpty(int i, int j)
	{
		if(i < Globals.MAP_I && j < Globals.MAP_J)
			if(map[i][j] == null) return true;
		return false;
	}
	public Entity getEntity(int i, int j)
	{
		return map[i][j];
	}
}
